<?php ob_start(); ?> 
<?php header ('Content-type: text/xml; charset=utf-8'); ?>     
<?php include "constants.inc" ?>
<?php session_start(); ?>

<?php


function storeClubComment($comment, $clubId) {



	if (isset($comment) && isset($clubId) && is_numeric($clubId) == true) {

    $connect = mysql_connect(DB_SERVER, DB_USER, DB_PWD);

		mysql_select_db(DB_CATALOG);



		$query = "select tournament_id from zt_tournament where isCurrent = 1";

    $result = mysql_query($query, $connect);

    $row = mysql_fetch_assoc($result);

    $tournamentId = $row['tournament_id'];

    if ( mysql_errno() != 0 ) {

      $error = $query." -> ".mysql_error();

      return "Fout tijdens opslagen commentaar (".$error.")";

    }



		$query = sprintf("update zt_subscription set wishes = '%s' where

      club_id = %d and tournament_id = %u", mysql_escape_string($comment),

      $clubId, $tournamentId);

	  $result = mysql_query($query, $connect);

    return mysql_affected_rows($result);

	}



  return '0';

}

?>

<response>

  <method>storeClubComment</method>

  <result><?php

    echo storeClubComment($_GET['comment'], $_GET['clubId']) ?>

  </result>

</response>